package edu.famework.demo3;

public class Master {
    /**
     * 带成绩不合格的同学去上课
     * @param school
     */
    public void attends(School school){
        if(school.getGrade()<60){
            school.study();
        }
    }

    /**
     * 让工资不合格的老师去教课
     */
    public void teach(School school){
        if (school instanceof Teacher){
            Teacher teacher = (Teacher) school;
            teacher.Teaching();
        }else if(school instanceof Student){
            Student student = (Student) school;
            student.Attend();
        }
    }

    public static void main(String[] args) {
        Master master = new Master();

        Student student = new Student();
        master.attends(student);

        Teacher teacher = new Teacher();
        master.teach(teacher);
    }

}
